using System.Diagnostics.CodeAnalysis;
using Digitalmes.Domain.SeedWork;
using SqlSugar;

namespace Digitalmes.Infrastructure.IntegrationTests.Models;

/// <summary>
/// 订单
/// </summary>
/// <remarks>
/// MySQL: 
/// <code>
/// DROP TABLE IF EXISTS `my_order`;
/// CREATE TABLE `my_order` (
///   `Id` 					    bigint(20) NOT NULL COMMENT 'Id',
///   `Name`			      varchar(64) NOT NULL COMMENT '订单名称',
///   `Customer`				varchar(64) DEFAULT NULL COMMENT '客户',
///   `Source` 				  varchar(32) DEFAULT NULL COMMENT '贡献者来源',
///   `Status` 				  int NOT NULL DEFAULT 1 COMMENT '状态',
///   `CreatedBy`			  varchar(64) DEFAULT NULL COMMENT '创建人',
///   `CreatedTime` 		datetime NOT NULL COMMENT '创建时间',
///   `UpdatedBy` 			varchar(64) DEFAULT NULL COMMENT '修改人',
///   `UpdatedTime` 		datetime DEFAULT NULL COMMENT '修改时间',
///   PRIMARY KEY(`Id`)
/// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT = DYNAMIC COMMENT='订单表';
/// </code>
/// </remarks>
[SugarTable("my_order")]
public sealed class MyOrder : AuditedEntity
{
    [NotNull]
    public string? Name { get; set; }

    public string? Customer { get; set; }

    public string? Source { get; set; }

    public StatusEnum Status { get; set; }

    [NotNull]
    [Navigate(NavigateType.OneToMany, nameof(MyOrderItem.OrderId))]
    public List<MyOrderItem>? Items { get; set; }
}
